import axios from '@/components/util/AxiosPlugin';
import GlobalUtil from '@/components/util/GlobalUtil';

/** 获取验证码 */
export function getCaptcha(callback) {
    return axios.get('/publish-gateway/gateway/captcha/get').then(data => callback(data)).catch(e => GlobalUtil.catchError(e));
}

/** 用户登陆 */
export function login(form, callback) {
    return axios.post('/publish-gateway/user/login', form).then(data => callback(data)).catch(e => GlobalUtil.catchError(e));
}


/** 用户注册 */
export function register(form, callback) {
    return axios.post('/publish-gateway/user/register', form).then(data => {callback(data); GlobalUtil.sucessNotify();}).catch(e => GlobalUtil.catchError(e));
}
